import copy


def solve(matrix):
    m = len(matrix)
    n = len(matrix[0])
    temp = copy.deepcopy(matrix)
    for i in range(m):
        for j in range(n):
            matrix[j][n - i - 1] = temp[i][j]

    return matrix


if __name__ == "__main__":
    matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
    matrix = solve(matrix)
    for i in range(len(matrix)):
        print(matrix[i])
